﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using SMS.DAL;

namespace SMS.Web.Service
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "AppHealthService" in code, svc and config file together.
    public class AppHealthService : IAppHealthService
    {
        
        public List<Entities.UserActivity> GetUserActivity(string userName, DateTime fromDate, DateTime toDate, out Entities.SMSException serviceError)
        {
            try
            {
                serviceError = null;
                return new AppHealthDA().GetObjectList(userName, fromDate, toDate);
            }
            catch (Exception ex)
            {
                serviceError = new Entities.SMSException(ex);
                return null;
            }
        }

        public List<Entities.ExceptionLog> GetExceptionHistory(string userName, DateTime fromDate, DateTime toDate, out Entities.SMSException serviceError)
        {
            try
            {
                serviceError = null;
                return new AppHealthDA().GetExceptionHistory(userName, fromDate, toDate);
            }
            catch (Exception ex)
            {
                serviceError = new Entities.SMSException(ex);
                return null;
            }
        }

        public List<Entities.LoginHistory> GetLoginHistory(string userName, DateTime fromDate, DateTime toDate, out Entities.SMSException serviceError)
        {
            try
            {
                serviceError = null;
                return new AppHealthDA().GetLoginHistory(userName, fromDate, toDate);
            }
            catch (Exception ex)
            {
                serviceError = new Entities.SMSException(ex);
                return null;
            }
        }
    }
}
